package src.unapec.seguridad.ejemplos.PasswordGenerator;

import java.util.Random;

public class PasswordGenerator{
	
  private final int MIN_LENGTH = 10;
  private Random r = new Random();
  
  //http://www.multicians.org/thvv/gpw.html
  
  private char[] goodChar = { 'a', 'b', 'c', 'd', 'e', 'f', 'g',
      'h', 'j', 'k', 'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',
      'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K',
      'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z',
      '2', '3', '4', '5', '6', '7', '8', '9', '+', '-', '@', };

  /* Generate a Password object with a random password. */
  public String getPassword() {
	  
    StringBuffer sb = new StringBuffer();
    
    for (int i = 0; i < MIN_LENGTH; i++) {
    
    	sb.append(goodChar[r.nextInt(goodChar.length)]);
    
    }
    
    return sb.toString();
    
  }
}
